<template>
    <fieldset>
        <textarea name="" id="" cols="30" rows="10" v-model="content"></textarea>
        <button @click="addCom(content)">上传评论</button>
    </fieldset>
</template>
<script>
import * as api from "@/api/comment"
import {mapActions} from "vuex"
export default{
    data(){
        return{
            content:'',
            name:"hh"
        }
    },
    methods:{
        ...mapActions("comment",['FETCH_COMMENT']),
        async addCom(){
            let res =await api.addComment(this.content,this.name)
            console.log(res)
            // 上传之后重新获取列表
            if(res.data.state){
                this.FETCH_COMMENT()
            }

        }
        
    }

}
</script>

